class Api::V1::SeckillSpusController < Api::V1::BaseController
  skip_before_action :authenticate_request!

  def index
    if params[:seckill_time].blank?
      render json: { result: false, message: '缺少参数.' }, status: :ok and return
    end
    begin_time = DateTime.parse("#{Time.now.strftime('%Y/%m/%d')} #{params[:seckill_time]}")
    @seckill_spus = SeckillSpu.between_times(begin_time, begin_time + 2.hours).where(state: :approve).order("created_at DESC").page(params[:page]).per(params[:per])
  end
end
